package testcases.OpportunitiesBaseDataView.MainViewAfterFilterSelection.ITS;
import resources.testcases.OpportunitiesBaseDataView.MainViewAfterFilterSelection.ITS.F09_Opportunities_Base_Data_View_Simple_Filter_Revenue_filterHelper;
import tasks.Loading;
import tasks.OpportunitiesBaseData.Filters.Applier;
import tasks.OpportunitiesBaseData.MainView.Filters;
import tasks.OpportunitiesBaseData.MainView.STGVerifierAfterAppliedFilters;

import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.SAP.*;
import com.rational.test.ft.object.interfaces.WPF.*;
import com.rational.test.ft.object.interfaces.dojo.*;
import com.rational.test.ft.object.interfaces.siebel.*;
import com.rational.test.ft.object.interfaces.flex.*;
import com.rational.test.ft.object.interfaces.generichtmlsubdomain.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import com.ibm.rational.test.ft.object.interfaces.sapwebportal.*;

import core.Configurations;
import core.ControlsMapping;
import core.Preconditions;
import core.enums.Reports;
/**
 * Description   : Functional Test Script
 * @author dimitar.vasilev
 */
public class F09_Opportunities_Base_Data_View_Simple_Filter_Revenue_filter extends F09_Opportunities_Base_Data_View_Simple_Filter_Revenue_filterHelper
{
	/**
	 * Script Name   : <b>F09_Opportunities_Base_Data_View_Simple_Filter_Revenue_filter</b>
	 * Generated     : <b>Dec 15, 2011 6:29:38 PM</b>
	 * Description   : Functional Test Script
	 * Original Host : WinNT Version 6.1  Build 7601 (S)
	 * 
	 * @since  2011/12/15
	 * @author dimitar.vasilev
	 */
	private boolean stepResult = false;
	private Applier filterApplier = new Applier();
	private STGVerifierAfterAppliedFilters verifier = new STGVerifierAfterAppliedFilters();
	private Filters filter = new Filters();
	
	private String opportunityRevenue = "<50K";
	private String totalOpportunityValue = "<50K";
	private String brandOfferingType = "ITS";
	
	private boolean testCasePreconditions() {
		boolean preconditionResult = false;
		preconditionResult = Preconditions.globalPreconditionCognos(Reports.OpportunitiesBaseDataView);
		return preconditionResult;
	}

    public void executeTest()
    {
        beginTestCase("F09",
                      "Verify that the fields in the Front End - Opportunities Base Data View - Main View - STG Brand, after applied Revenue Filter, are populated with the respective data from Data Base after applied filters",
                      "",
                      "Dimitar Vasilev",
                      "",
                      "");
        
        if (testCasePreconditions())
        {     
        	TimeWait(3);
        	
        	//applied desired combination of filter selections
        	stepResult = ControlsMapping.FilterCommonElements.showAll_link.clickLink();
        	setStepResult(stepResult, "Click " + ControlsMapping.FilterCommonElements.showAll_link.getDescriptiveName());
        	
        	Loading.waitToComplete();
        	
        	filterApplier.applyRevenueFilter(opportunityRevenue, totalOpportunityValue, false);
        	filterApplier.applyProductFilter(brandOfferingType, null, null, null, null, null, null, null, null, null, null, null, false);
        	filter.setBrand_cd(brandOfferingType); 
        	filter.setSectors(opportunityRevenue);
        	filter.setIndustry(totalOpportunityValue);

        	
        	stepResult = ControlsMapping.FilterCommonElements.GO_button.clickButton();
        	setStepResult(stepResult, "Click " + ControlsMapping.FilterCommonElements.GO_button.getDescriptiveName());
        	
        	Loading.waitToComplete();
        	
        	stepResult = verifier.verify(filter);
        	setStepResult(stepResult, "Verify front end and DB content.");
        }
    }
    
    public void testMain(Object[] args)
    {
    	setUp(args);
        executeTest();
        reportTestCaseResult("F09 - Opportunities Base Data View - Simple Filter", Configurations.PROJECT_NAME);
    }
}

